// import request from "../utils/axios"
import axios from "axios";
import api from "../request/request";

//Tab表头
export const ActicleTab = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/category",
    method: "get",
  });
};
//tab切换路由列表
export const articleTab = (id) => {
  return api({
    url: `https://bjwz.bwie.com/wipi/api/article/category/${id}?page=1&pageSize=12&status=publish`,
    method: "get",
  });
};
////article a标签
export const articleA = () => {
  return api({
    url: "https://bjwz.bwie.com/wipi/api/tag?articleStatus=publish",
  });
};
//Tab内容
export const ActicleList = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/article?page=1&pageSize=12&status=publish",
    method: "get",
  });
};
//article轮播
export const articleSwiper = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/article/all/recommend",
    method: "get",
  });
};

//archivesTab
export const archivesMain = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/article/archives",
    method: "get",
  });
};

//knoeledge
export const getKnowledgeMain = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/Knowledge",
    method: "get",
  });
};
export const Tiankongdeil = (id) => {
  return axios({
    url: `https://bjwz.bwie.com/wipi/api/Knowledge/${id}`,
    method: "get",
  });
};

//右侧第一格 recommendToReading
export const GetData = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/article/recommend",
    method: "get",
  });
};

//右侧第二格  tagTitle
export const TagTitle = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/tag",
    method: "get",
  });
};
//tagTitle内容
export const tagTitleList = (id) => {
  return axios({
    url: `https://bjwz.bwie.com/wipi/api/article/tag/${id}`,
    method: "get",
  });
};
export const CategoryTitle = () => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/category",
    method: "get",
  });
};

//跳详情+id
export const DetailData = (id) => {
  return axios({
    url: "https://bjwz.bwie.com/wipi/api/article/" + id,
    method: "get",
  });
};

//article
export const articleDetail = (id) => {
  return axios({
    url: `https://bjwz.bwie.com/wipi/api/article/${id}/views`,
    method: "post",
  });
};
//搜索数据
export const getSearch = async (keyword) => {
  const data = await axios.get(
    "https://bjwz.bwie.com/wipi/api/search/article",
    {
      params: {
        keyword,
      },
    }
  );
  return data.data.data;
};
// export const Acticlelikes = (params) => {
//   return axios({
//     url: `https://bjwz.bwie.com/wipi/api/article/${id}/likes`,
//     method: "post",
//     params,
//   });
// };
